#./set_otafile.sh oem_quec_bk7231n_matter_light5_132_UG.rbl.bin  10132 1.0.132 matter_light

if [ $# -lt 4 ]; then
  echo "input param erro!!!"
  echo "./set_otafile.sh  xxx.UG.rbl.bin version verison_str outputfile_prefix"
  exit 1
fi



FILE_NAME=${1}
MATTER_VERSION=${2}
MATTER_VERSION_STR=${3}
OTA_FILE_NAME=${4}

# if [-z "$FILE_NAME" ]; then
#     echo "plese input ota file name"
#     exit
# fi
mkdir bin/${OTA_FILE_NAME}
python ota_image_tool.py create -v 0x1410 -p 0x03e9 -vn ${MATTER_VERSION} -vs ${MATTER_VERSION_STR} -da sha256 ${FILE_NAME} bin/${OTA_FILE_NAME}/${OTA_FILE_NAME}_${MATTER_VERSION_STR}.ota

./show_info.sh bin/${OTA_FILE_NAME}/${OTA_FILE_NAME}_${MATTER_VERSION_STR}.ota
mv ${FILE_NAME} bin/${OTA_FILE_NAME}

git add .
git commit -m "add ${OTA_FILE_NAME}_${MATTER_VERSION_STR}.ota"
git push origin master

